{
  "properties" : { },
  "id" : "4ae5bcd3e5f448499513e2a19e9e28e8",
  "script" : null,
  "groupId" : "ded0996d4aa14841ae2d40edb1fa6d63",
  "name" : "查询设备列表",
  "createTime" : 1727071130343,
  "updateTime" : 1727062392449,
  "lock" : "0",
  "createBy" : "ndmp",
  "updateBy" : "ndmp",
  "path" : "list",
  "method" : "GET",
  "parameters" : [ {
    "name" : "ip",
    "value" : "192.100.5.21",
    "description" : "",
    "required" : false,
    "dataType" : "String",
    "type" : "",
    "defaultValue" : "",
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ ]
  }, {
    "name" : "current",
    "value" : "1",
    "description" : "",
    "required" : false,
    "dataType" : "String",
    "type" : "",
    "defaultValue" : "",
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ ]
  }, {
    "name" : "size",
    "value" : "30",
    "description" : "",
    "required" : false,
    "dataType" : "String",
    "type" : "",
    "defaultValue" : "",
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ ]
  } ],
  "options" : [ ],
  "requestBody" : "",
  "headers" : [ ],
  "paths" : [ ],
  "responseBody" : "{\n    \"status\": 200,\n    \"message\": \"success\",\n    \"data\": []\n}",
  "description" : "",
  "requestBodyDefinition" : {
    "name" : "",
    "value" : { },
    "description" : "",
    "required" : false,
    "dataType" : "String",
    "type" : "",
    "defaultValue" : "",
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ ]
  },
  "responseBodyDefinition" : {
    "name" : "",
    "value" : "",
    "description" : "",
    "required" : false,
    "dataType" : "Object",
    "type" : "",
    "defaultValue" : "",
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ {
      "name" : "code",
      "value" : "500",
      "description" : "",
      "required" : false,
      "dataType" : "Integer",
      "type" : "",
      "defaultValue" : "",
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "success",
      "value" : "false",
      "description" : "",
      "required" : false,
      "dataType" : "Boolean",
      "type" : "",
      "defaultValue" : "",
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "data",
      "value" : "",
      "description" : "",
      "required" : false,
      "dataType" : "Object",
      "type" : "",
      "defaultValue" : "",
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "msg",
      "value" : "系统维护中，请稍后重试。",
      "description" : "",
      "required" : false,
      "dataType" : "String",
      "type" : "",
      "defaultValue" : "",
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    } ]
  }
}
================================
import org.springblade.core.secure.utils.AuthUtil
import org.springblade.common.cache.DictCache
import redis

BladeUser user = AuthUtil.getUser();
Long userId = 0L;
if (null != type && type == 99) {
    userId = user.getUserId();
}


var token = header.get("blade-auth")::string;
var dccId = redis.get(token.substring(7))

var sql = """
     SELECT
            subquery.* ,
            dl.reachable,
            dmi.device_firm,
         dmi.device_model_name,
            dcc.dept_name group_name,
            CASE
            WHEN dl.status = 'RUNNING' THEN
            1 ELSE 0
            END gatherStatus
        FROM 
        (SELECT ID,
        CASE

        WHEN device_alias IS NOT NULL and length(device_alias)>0
            THEN
        device_alias ELSE device_name
        END device_name,
        ip,
        sn_code,
        asset_no,
        dcc_id ,
        operate_date,
        expiry_date,
        device_type,
        soft_version,
        device_model_id,
        voltage_level,
        net_region,
        LOCATION,
        station_prop,
        station_name,
        station_type,
        dcc_caliber,
        open_status,
        create_time,
        update_time,
        access_network,
        mtnc_status FROM ndmp_device dev
        where   mtnc_status = 0  
        
        <if test=" !is_blank(dccId) ">
            and dev.dcc_id=#{dccId}
        </if>

        <if test="ip != null and ip != '' ">
            and ip like concat('%',#{ip},'%')
        </if>
        <if test="stationType != null">
            and station_type = #{stationType}
        </if>
        <if test="deviceAlias != null and deviceAlias != '' ">
            and device_alias like concat('%',#{deviceAlias},'%')
        </if>
        <if test="deviceName != null and deviceName != '' ">
            and (device_name like concat('%',#{deviceName},'%') or
                F_PINYIN(device_name) like UPPER(concat('%',#{deviceName},'%'))) or
            (device_alias like concat('%',#{deviceName},'%') or
  F_PINYIN(device_alias) like UPPER(concat('%', #{deviceName} ,'%')) )
        </if>
        <if test="voltageLevel != null and voltageLevel != ''">
            and VOLTAGE_LEVEL = #{voltageLevel}
        </if>
        <if test="deviceType != null and deviceType !=''">
            and device_type = #{deviceType}
        </if>
        <if test="deviceModelId != null ">
            and device_model_id = #{deviceModelId}
        </if>
        <if test="openStatus != null ">
            and open_status = #{openStatus}
        </if>
        <if test="stationType != null ">
            and station_type = #{stationType}
        </if>

        <if test="deptId!= null ">
            and id in (select  device_id from ndmp_group_device_relation  where group_id = #{deptId} )
        </if>
        ) AS subquery
        left JOIN da_link dl  on subquery.id=dl.task_id
        LEFT JOIN blade_dept dcc on  cast(dcc.id as VARCHAR)= subquery.dcc_id
        LEFT JOIN ndmp_net_device_model_info dmi ON   dmi.id    = subquery.device_model_id
        where  dl.ip  not in (select DEVICE_ID from NDMP_DEVICE_BLACK_LIST)
        <!--  99-设备维护 -->
        <if test="type == 99 ">
            and dl.task_id in (
            SELECT
            device_id
            FROM
            ndmp_user_duty_area  where user_id=#{userId})
        </if>

        ORDER BY device_name
       """

var pageRes = db.page(sql)

List list = pageRes.records
if (null == list) {
    return new ArrayList()
}

list.forEach(v -> {

    v.netRegionStr = (v.netRegion = null ? "" : DictCache.getValue("netRegion", v.netRegion.intValue()))
    //采集状态
    if ("1".equals(v.gatherStatus)) {
        v.gatherStatus = "已采集";
    } else if ("0".equals(v.gatherStatus)) {
        v.gatherStatus = "未采集";
    }
    //网络状态
    if ("1".equals(v.reachable)) {
        v.reachable = "网络正常";
    } else if ("2".equals(v.reachable)) {
        v.reachable = "网络异常";
    }
    //运行状态
    if (null != v.openStatus && 1 == v.openStatus) {
        v.openStatusStr = "在运";
    } else if (null != v.openStatus && 0 == v.openStatus) {
        v.openStatusStr = "检修";
    }
    //厂站类型
    v.stationTypeStr = (v.stationType == null ? "" : DictCache.getValue("stationType", v.stationType.intValue()))
    //站点属性
    v.stationPropStr = (v.stationProp == null ? "" : DictCache.getValue("stationProp", v.stationProp.intValue()))
    v.deviceFirmStr = (v.deviceFirm == null ? "" : DictCache.getValue("deviceFirm", v.deviceFirm.intValue()))
    //组织机构
    v.accessNetworkStr = (v.accessNetwork == null ? "" : DictCache.getValue("accessNetwork", v.accessNetwork.intValue()))
    //设备温度
    // PointObject point = StringRedisTemplateUtil.getPoint(v.getId(), "temperature");
    // if (point != null) {
    //     v.setHeat(point.getValue().values().toString().replace("[", "").replace("]", ""));
    // }
});


return pageRes